import React, { PureComponent } from 'react'
import { connect } from 'react-redux'
import { actionCreators } from './store'

import {
    LoginWrapper,
    LoginMain,
    LoginBtn
} from './style'
class Login extends PureComponent {
    render () {
        const { login } = this.props;
        return (
            <LoginWrapper>
                <LoginMain>
                    <input placeholder="用户名" ref={(input) => {this.acount = input}}/>
                    <input placeholder="密码" ref={(input) => {this.passWord = input}} />
                    <LoginBtn onClick={() => login(this.acount, this.passWord)}>登陆</LoginBtn>
                </LoginMain>
            </LoginWrapper>
        )
    }

    
};

const mapDispatchToProps = (dispatch) => ({
    login (acount, passWord) {
        console.log(acount.value, passWord.value)
        //dispatch(actionCreators.changeLogin())
    }
});


export default connect(null, mapDispatchToProps)(Login)